﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Mvc.Common;
@using FwProject.Distribution.Dto
@using FwProject.Core.Distribution
@model IPagedList<RestaurantDistributionView>
@{
    Layout = null;
    //int SumDistributioncount = 0;
    //int SumRecoveryBycount = 0;
    //int SumExchangegoodscount = 0;
    //int SumDamagecount = 0;
    //int SumGivecount = 0;
    //int SumBackboxcount = 0;
    //int SumBacknumbercount = 0;
    //decimal SumPrice = 0;
    int i = 0;
    if (Model.Count > 0)
    {
        if (Model.PageNumber != 1)
        {

            i = (Model.PageNumber - 1) * Model.PageSize;
        }
    }
}
<div id="table_print" style="max-height:600px;overflow-y:scroll;">

    <table class="table table-bordered table-hover table-rowselected">
        <thead>
            <tr>
                <th style="width:45px">序号</th>
                <th>餐厅名称</th>
                <th>配送箱数</th>
                <th>配送套数</th>
                <th>回收箱数</th>
                <th>回收套数</th>
                <th>换货箱数</th>
                <th>换货套数</th>
                <th>折损套数</th>
                <th>赠送箱数</th>
                <th>赠送套数</th>
                <th>退回箱数</th>
                <th>退回套数</th>
                <th>金额（￥）</th>
                @*<th style="width:200px;">操作</th>*@
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td class="text-center" colspan="10">暂无信息</td></tr>
            }
            else
            {
                foreach (var item in Model)
                {
                    i++;
                    <tr>
                        <td>@i</td>
                        <td>@item.RestaurantName</td>
                        <td>@item.Distributioncount</td>
                        <td>@item.DistributionBycount</td>
                        <td>@item.Recoverycount</td>
                        <td>@item.RecoveryBycount</td>
                        <td>@item.Exchangegoodscount</td>
                        <td>@item.ExchangegoodsBycount</td>
                        <td>@item.Damagecount</td>
                        <td>@item.Givecount</td>
                        <td>@item.Givebycount</td>
                        <td>@item.Backboxcount</td>
                        <td>@item.Backnumbercount</td>
                        <td>@item.TotalPrice</td>
                    </tr>
                    //SumDistributioncount += item.Distributioncount;
                    //SumRecoveryBycount += item.Recoverycount;
                    //SumExchangegoodscount += item.Exchangegoodscount;
                    //SumDamagecount += item.Damagecount;
                    //SumGivecount += item.Givecount;
                    //SumBackboxcount += item.Backboxcount;
                    //SumBacknumbercount += item.Backnumbercount;
                    //SumPrice += item.TotalPrice;
                }
                @*<tr>
                        <td style="color:red;text-align:center" colspan="2">该页小计</td>
                        <td style="color:red">@SumDistributioncount</td>
                        <td style="color:red">@SumRecoveryBycount</td>
                        <td style="color:red">@SumExchangegoodscount</td>
                        <td style="color:red">@SumDamagecount</td>
                        <td style="color:red">@SumGivecount</td>
                        <td style="color:red">@SumBackboxcount</td>
                        <td style="color:red">@SumBacknumbercount</td>
                        <td style="color:red">@SumPrice</td>
                    </tr>*@
                    <tr class="footer" style="background-color:darkgray">
                        <td style="color:red;text-align:center" colspan="2">总合计</td>
                        <td style="color:red">@ViewBag.Distributioncount</td>
                        <td style="color:red">@ViewBag.DistributionBycount</td>
                        <td style="color:red">@ViewBag.Recoverycount</td>
                        <td style="color:red">@ViewBag.RecoveryBycount</td>
                        <td style="color:red">@ViewBag.Exchangegoodscount</td>
                        <td style="color:red">@ViewBag.ExchangegoodsBycount</td>
                        <td style="color:red">@ViewBag.Damagecount</td>
                        <td style="color:red">@ViewBag.Givecount</td>
                        <td style="color:red">@ViewBag.Givebycount</td>
                        <td style="color:red">@ViewBag.Backboxcount</td>
                        <td style="color:red">@ViewBag.Backnumbercount</td>
                        <td style="color:red">@ViewBag.TotalPrice</td>
                    </tr>
            }
        </tbody>
    </table>

</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        @*共 @Model.TotalItemCount 条，@Model.PageSize 条/页 当前第 @Model.PageNumber/@Model.PageCount 页*@
        共 @Model.TotalItemCount 条，
        <select class="form-control" id="pageSize1" style="width:70px;display:initial">
            @for (int z = 10; z < 100; z = z + 10)
            {
                if (z == Model.PageSize)
                {
                    <option selected value="@z">@z</option>
                }
                else
                {
                    <option value="@z">@z</option>
                }
            }
        </select> &nbsp;条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        <input type="hidden" id="pageurl" value="&RestaurantName=@(Context.Request.Query["RestaurantName"])&DriverName=@(Context.Request.Query["DriverName"])&beginTime=@(Context.Request.Query["beginTime"])&endTime=@(Context.Request.Query["endTime"])&key=1" />
        @Html.PagedListPager(Model, page => Url.Action("RestaurantDistribution", new { pageIdx = page, size1 = Context.Request.Query["size1"], RestaurantName = Context.Request.Query["RestaurantName"], DriverName = Context.Request.Query["DriverName"], beginTime = Context.Request.Query["beginTime"], endTime = Context.Request.Query["endTime"], key = 1 }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list1", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>



